package cn.tedu.web;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.thymeleaf.context.Context;

import cn.tedu.dao.DeptDao;
import cn.tedu.entity.Dept;
import cn.tedu.utils.ThyUtils;

/**
 * Servlet implementation class ShowAddServlet
 */
public class ShowAddServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//通过DeptDao 查询所有部门
		DeptDao dao=new DeptDao();
		List<Dept> depts=dao.findAll();
		//把查询的数据传输到add.HTML
		Context context=new Context();
		context.setVariable("depts", depts);
		
		ThyUtils.write("add", response, context);
		
	}
}
